#include "SessionPresence.h"

SessionPresence& SessionPresence::operator=( const SessionPresence& other )
{
  if (this == &other)
    return *this;
  m_id = other.m_id;  
  m_sessionId = other.m_sessionId;  
  m_memberId = other.m_memberId;
  return *this;
}

bool SessionPresence::operator==( const SessionPresence& other ) const
{
  return m_id == other.m_id &&

    m_sessionId == other.m_sessionId &&

    m_memberId == other.m_memberId;
}

std::ostream& operator<<( std::ostream& stream, const SessionPresence &sessionPresence )
{
  return stream << 
    sessionPresence.id() << c_delm <<

    sessionPresence.sessionId() << c_delm <<

    sessionPresence.memberId() << std::endl;
}

std::istream& operator>>( std::istream& stream, SessionPresence& sessionPresence )
{
  CsvRow row;
  stream >> row;
  if (row.empty())
    return stream;
  sessionPresence = SessionPresence(row[0], row[1], row[2]);
  return stream;
}